import myaxios from "../MyAxios"
import BASEURL from '../BaseUrl' 
const JKTURL = BASEURL.JKTURL

const gradesApi = {

  /**
   * // 添加成绩
   * @param {Object} params  { grade_num:xx, grades_avg:xx grade_time:xx, grade_date:xx, grade_subj:xx, userId:xx}
   */
  add(params){
    let url = JKTURL + "/grades/add"
    return myaxios.post(url, params)
  },

  // 查询用户成绩单 (按日期排)
  queryByUser(params){
    let url = JKTURL + "/grades/user"
    return myaxios.get(url, params)
  },

  // 查询用户成绩单 (按日期降序排)
  queryByUserA(params){
    let url = JKTURL + "/grades/user/1"
    return myaxios.get(url, params)
  },

  // 查询用户成绩单 (按分数排)
  queryByUserB(params){
    let url = JKTURL + "/grades/user/2"
    return myaxios.get(url, params)
  },

  // 查询所有用户成绩排名
  queryRanking(params){
    let url = JKTURL + "/grades/ranking"
    return myaxios.get(url, params)
  },

  // 查询所有用户平均分排名
  queryAvg(params){
    let url = JKTURL + "/grades/avg"
    return myaxios.get(url, params)
  },

}

export default gradesApi